package com.qk.management.service.validator;

import org.springframework.web.multipart.MultipartFile;

public abstract class FileValidationHandler {
    protected FileValidationHandler nextHandler;
    
    public FileValidationHandler setNext(FileValidationHandler nextHandler) {
        this.nextHandler = nextHandler;
        return nextHandler;
    }
    
    public void validate(MultipartFile file) throws ValidationException {
        handle(file);
        if (nextHandler != null) {
            nextHandler.validate(file);
        }
    }
    
    protected abstract void handle(MultipartFile file) throws ValidationException;
}